//package com.bigmi.common.smsTemplate.template;
//
//import com.aliyun.dysmsapi20170525.Client;
//import com.aliyun.dysmsapi20170525.models.SendSmsResponse;
//import com.aliyun.dysmsapi20170525.models.SendSmsResponseBody;
//import com.aliyuncs.DefaultAcsClient;
//import com.aliyuncs.IAcsClient;
//import com.aliyuncs.profile.DefaultProfile;
//import com.bigmi.common.smsTemplate.properties.SmsProperties;
//
//
//public class SmsTemplate {
//    private SmsProperties properties;
//    public SmsTemplate(SmsProperties properties){
//        this.properties=properties;
//    }
//    public void sendSms(String mobile,String code) throws Exception {
//        try {
//             /*String accessKeyId="LTAI5tAHYAgV6zPFR68Nxzzb";
//             String accessKeySecret="JDJ4D8ApnIqwqKumI4uWUcW7fNX2zp";*/
//            DefaultProfile profile = DefaultProfile.getProfile("cn-shanghai", properties.getAccessKey(),properties.getSecret());
//
//            //配置阿里云
//            com.aliyun.teaopenapi.models.Config config = new com.aliyun.teaopenapi.models.Config()
//                    // 您的 AccessKey ID
//                    .setAccessKeyId(properties.getAccessKey())
//                    // 您的 AccessKey Secret
//                    .setAccessKeySecret(properties.getSecret());
//            // 访问的域名
//            config.endpoint = "dysmsapi.aliyuncs.com";
//            IAcsClient client = new DefaultAcsClient(profile);
//            //Client client = new Client( profile );
//
//            com.aliyun.dysmsapi20170525.models.SendSmsRequest sendSmsRequest = new com.aliyun.dysmsapi20170525.models.SendSmsRequest()
//                    .setSignName(properties.getSignName())
//                    .setTemplateCode(properties.getTemplateCode())
//                    .setPhoneNumbers(mobile)
//                    .setTemplateParam("{\"code\":\""+code+"\"}");
//            com.aliyun.teautil.models.RuntimeOptions runtime = new com.aliyun.teautil.models.RuntimeOptions();
//            /*SendSmsResponse response = client.sendSmsWithOptions( sendSmsRequest, runtime );
//            SendSmsResponseBody body = response.getBody();
//            System.out.println(body.getMessage());*/
//        }catch (Exception e) {
//            e.printStackTrace();
//        }
//       /* try {
//            // 复制代码运行请自行打印 API 的返回值
//           // client.sendSmsWithOptions( sendSmsRequest, runtime );
//        } catch (TeaException error) {
//            // 如有需要，请打印 error
//            com.aliyun.teautil.Common.assertAsString(error.message);
//        } catch (Exception _error) {
//            TeaException error = new TeaException(_error.getMessage(), _error);
//            // 如有需要，请打印 error
//            com.aliyun.teautil.Common.assertAsString(error.message);
//        }*/
//    }
//}
//
